<?php
session_start();
if (!empty($_GET['nit1'])) {
    $id = $_GET['nit1'];
}

include 'database.class.php';
$db = new Database();
$db->dbConnect();
$sql = mysql_query("SELECT
    nit
    , razon
    , direccion
    , telefono
    , municipio
    , estado
    , nombre
FROM
    empresa WHERE nit= $id");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="css/default.css" rel="stylesheet" type="text/css" />
        <script type="text/javascript" src="js/jquery-1.4.3.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.8.6.custom.min.js"></script>
        <script type="text/javascript" src="js/jquery.validate.js" ></script>
  <script type="text/javascript">
            $(document).ready(function() {
                $("#form-contacto").validate();
            });
        </script>
        <style type="text/css">
            #commentForm { width: 500px; }
            #commentForm label { width: 250px; }
            #commentForm label.error, #commentForm input.submit { margin-left: 253px; }
        </style>
        <title>Editar Empresa</title>
    </head>
    <!--body-->
    <body>
        <div id="wrapper">
<?php include 'include/header.php'; ?>
            <!-- end div#header -->
            <div id="page">
                <div id="content">
                    <div id="welcome">
                        <h1>Editar Empresa</h1>
                        <p><img src="images/warning.png" width="30" height="30">  El codigo de la empresa no podra ser modificado</p>

                        <div id="form-area">
                            
                                <h2>Editar empresa <?php echo $id ?></h2>
                                <form action="include/actualizar-form-emp.php" method="post" id="form-contacto">
                                    <fieldset>
<?php
while ($fila = mysql_fetch_array($sql)) {
?>
                                    <dl>
                                        <dt><label for="nit1" style="visibility: hidden">Nit *</label></dt>
                                        <dd><input type="hidden" name="nit1" id="nit1" value="<?php echo $id ?>" class="digits required" minlength="10" maxlength="30"/></dd>
                                        <div style="clear: both; height: 1px"></div>
                                        <dt><label for="nombre">Nombre *</label></dt>
                                        <dd><input type="text" name="nombre" id="nombre" value="<?php echo$fila["nombre"]; ?>" class="required" minlength="2" maxlength="50"/></dd>
                                        <dt><label for="razon">Razon Social *</label></dt>
                                        <dd><input name="razon" id="razon" value="<?php echo$fila["razon"]; ?>" class="required" minlength="5" maxlength="100"/></dd>
                                        <dt><label for="fijo">Telefono Fijo</label></dt>
                                        <dd><input type="text" name="fijo" id="fijo" value="<?php echo$fila["telefono"]; ?>" class="digits" minlength="7" maxlength="7"/></dd>
                                        <dt><label for="dir">Direccion *</label></dt>
                                        <dd><input type="text" name="dir" id="dir" value="<?php echo$fila["direccion"]; ?>" class="required" minlength="10"/></dd>
                                        <dt><label for="mun">Municipio *</label></dt>
                                        <dd><input type="text" name="mun" id="mun" value="<?php echo$fila["municipio"]; ?>" class="required" minlength="5"/></dd>
                                        <dt><label for="estado">Estado *</label></dt>
                                        <dd>
                                            <select name="estado" id="estado" class="required">
<?php
                                    if ($fila["estado"] == "1") {
                                        echo "<option value='0'>Inactivo</option>
                                                        <option value='1' selected>Activo</option>";
                                    } else {
                                        echo "<option value='0' selected>Inactivo</option>
                                                        <option value='1' >Activo</option>";
                                    }
?>
                                            </select>
                                        </dd>
                                        <dt class="center">
                                            <input type="submit" name="submit" title="Guardar" id="submit" value="" style="background-image:url(images/Save.png); width:50px; background-repeat:no-repeat; background-position:center;"/>

                                            <input type="reset" name="button" title="Restaurar"id="button" value="" style="background-image:url(images/Undo.png); width:50px; background-repeat:no-repeat; background-position:center;"/>
                                        </dt>
                                    </dl>
<?php
                                }
?>                                  </fieldset>

                                </form>
                            
                        </div>
                    </div>
                    <!-- end div#welcome -->
                </div>
                <!-- end div#content -->
                <div id="sidebar">
                    <ul>
<?php include 'include/nav.php'; ?>
                        <!-- end navigation -->
                    </ul>
                </div>
                <!-- end div#sidebar -->
                <div style="clear: both; height: 1px"></div>
            </div>
<?php include 'include/footer.php'; ?>
        </div>
        <!-- end div#wrapper -->
    </body>
    <!--body ends-->
</html>
